/**
 * Copyright (c) 2019-2029, wwww.kiwipeach.cn (liuburu@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package cn.kiwipeach.blog.service.impl;

import cn.kiwipeach.blog.generator.domain.SysUser;
import cn.kiwipeach.blog.generator.mapper.SysUserMapper;
import cn.kiwipeach.blog.mapper.CustomSysFunctionMapper;
import cn.kiwipeach.blog.mapper.CustomSysRoleMapper;
import cn.kiwipeach.blog.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import open.kiwipeach.autoconfigure.shiro.token.AccessToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 系统用户 服务实现类
 *
 * @author kiwipeach
 * @since 1.0
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Autowired
    private CustomSysRoleMapper customSysRoleMapper;

    @Autowired
    private CustomSysFunctionMapper customSysFunctionMapper;
    @Override
    public boolean createSysUser(AccessToken accessToken) {
        accessToken.setUserName(accessToken.getPlatform() + "_" + accessToken.getUserName());
        //1)保存基本用户信息
        return sysUserMapper.insert(accessToken) > 0;
    }

}
